<template>
  <div>
    <tb-report
      :schemas="schemas"
      :columns="columns"
      :apiUrl="apiUrl"
      :tableData="tableData"
      :getData="getData"
    ></tb-report>
  </div>
</template>

<script>
import TbReport from "@/components/tb-report/index.vue";

export default {
  name: "App",
  components: { TbReport },
  data() {
    return {
      title: "首页",
      apiUrl:"/scm/api/v1/scmContractInvoiceRegistrationHead/list",
      schemas: [
        {
          label: "发票号码",
          field: "invoiceNo",
          component: "Input",
          placeholder: "发票号码",
          required: false,
          colProps: {},
        },
        {
          label: "发票代码",
          field: "invoiceCode",
          component: "Input",
          placeholder: "发票代码",
          required: false,
          colProps: {},
        },
      ],
      columns: [
        {
          title: "序号",
          fixed: 'left', 
          type: "seq",
          width: 60,
          align: "center",
        },
        {
          title: "发票号码",
          key: "invoiceNo",
          field: "invoiceNo",
          width: 100,
          align: "center",
        },
        {
          title: "供应商名称",
          key: "supplier",
          field: "supplier",
          width: 100,
          align: "center",
        },
        {
          title: "状态",
          key: "invoiceStatusStr",
          field: "invoiceStatusStr",
          width: 100,
          align: "center",
        },
        {
          title: "发票代码",
          key: "invoiceCode",
          field: "invoiceCode",
          width: 100,
          align: "center",
        },
        {
          title: "发票开票日期",
          key: "invoiceDate",
          field: "invoiceDate",
          width: 100,
          align: "center",
        },
        {
          title: "税率",
          key: "rate",
          field: "rate",
          width: 100,
          align: "center",
        },
        {
          title: "供应商联系人",
          key: "supplierContactName",
          field: "supplierContactName",
          width: 100,
          align: "center",
        },
        {
          title: "联系人电话",
          key: "contactTel",
          field: "contactTel",
          width: 100,
          align: "center",
        },
        {
          title: "项目名称",
          key: "programName",
          field: "programName",
          width: 100,
          align: "center",
        },
        {
          title: "物资名称",
          key: "materialName",
          field: "materialName",
          width: 100,
          align: "center",
        },
        {
          title: "采购业务员",
          key: "purchaser",
          field: "purchaser",
          width: 100,
          align: "center",
        },
        {
          title: "内贸合同号",
          key: "contractNo",
          field: "contractNo",
          width: 100,
          align: "center",
        },
        
        {
          title: "合同总金额",
          key: "contractAmount",
          field: "contractAmount",
          width: 100,
          align: "center",
        },
        
        {
          title: "内贸开票总额",
          key: "tradeInvoiceTotalPrice",
          field: "tradeInvoiceTotalPrice",
          width: 100,
          align: "center",
        },
        
        {
          title: "未开票金额",
          key: "unbilledAmount",
          field: "unbilledAmount",
          width: 100,
          align: "center",
        },
        
        {
          title: "备注",
          key: "remark",
          field: "remark",
          width: 100,
          align: "center",
        },
        
        
      ],
      tableData:[]
    };
  },
  methods:{
    getData(data){
           if (this.tableData.length == 0) {
            this.tableData = data;
           } else {
            this.tableData = [...this.tableData, ...data];
          }
    }
  }
};
</script>

<style>
</style>
